# 作者: 肖老师
# 2024年11月15日14时03分12秒
# xxxrlmk@163.com

def use_open1():
    file = open('file.txt', encoding='utf8')  # 若不指定编码，默认与平台（windows）编码一致

    text = file.read()  # read参数是读取的字符大小

    print(text)
    print('-' * 50)
    text = file.read()
    print(text)
    file.close()


def use_open_w():
    file = open('file.txt', encoding='utf8', mode='w')
    file.write('你好python')
    file.close()


def use_open_rw():
    """
    练习r+
    :return:
    """
    file = open('file.txt', mode='r+', encoding='utf8')

    file.write('www')
    file.close()


def use_open_a():
    """
    练习a
    :return:
    """
    file = open('file.txt', mode='a', encoding='utf8')

    file.write('aaa')
    file.close()


# use_open1()
# use_open_w()
# use_open_rw()
use_open_a()
